package com.abc.recycling.repository;

import org.apache.ibatis.jdbc.SQL;
import java.util.Map;

public class EvaluationSqlProvider {
    
    public String searchEvaluations(Map<String, Object> params) {
        return new SQL() {{
            SELECT("*");
            FROM("evaluation");
            WHERE("1=1");
            
            if (params.get("userId") != null) {
                WHERE("user_id = #{userId}");
            }
            
            if (params.get("collectorId") != null) {
                WHERE("target_id = #{collectorId}");
            }
            
            if (params.get("status") != null) {
                WHERE("status = #{status}");
            }
            
            if (params.get("minRating") != null) {
                WHERE("rating >= #{minRating}");
            }
            
            if (params.get("maxRating") != null) {
                WHERE("rating <= #{maxRating}");
            }
            
            ORDER_BY("create_time DESC");
        }}.toString();
    }
} 